package so.sao.code.service.web.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import so.sao.code.service.domain.entity.CodeSupplierConfig;
import so.sao.code.service.service.CodeSupplierConfigService;

/**
 * 企业域名关系对应控制器
 * 
 * @author wjwei
 *
 */
@Api(tags = "codeSupplierConfig", value = "域名分配到企业的关系控制器")
@RestController
@RequestMapping("/api/codeSupplierConfig")
public class CodeSupplierConfigController {

	@Autowired
	CodeSupplierConfigService codeSupplierConfigService;

	@ApiOperation(value = "根据eseId查询分配的域名", notes = "根据eseId查询分配的域名信息")
	@GetMapping(value = "/get/{eseId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	public ResponseEntity<CodeSupplierConfig> getSupplierConfig(@PathVariable("eseId") Long eseId) {
		return new ResponseEntity<>(codeSupplierConfigService.getByCompanyId(eseId), HttpStatus.FOUND);
	}
}
